package apiday08.reflect;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class ReflectDemo8 {
    public static void main(String[] args) throws Exception {
        Teacher t = new Teacher();
        t.name = "张三";
        System.out.println(t);

        Class cls = Class.forName("apiday08.reflect.Teacher");
        Object obj = cls.newInstance();

        Field field = cls.getField("name");
        field.set(obj,"哇哈哈");
        System.out.println(obj);

        System.out.println(field.get(obj));
    }
}
